﻿<?xml version="1.0" encoding="utf-8"?><Articles><Article><ArticlesID>592</ArticlesID><Title>Lấy Primary key trong table - SQL Server</Title><Body>&amp;lt;pre title=&amp;quot;code&amp;quot; class=&amp;quot;brush: sql;&amp;quot;&amp;gt;
declare    @TableName varchar(128)
    select @TableName = 'system_price'
    
    select     c.COLUMN_NAME
    from     INFORMATION_SCHEMA.TABLE_CONSTRAINTS pk ,
        INFORMATION_SCHEMA.KEY_COLUMN_USAGE c
    where     pk.TABLE_NAME = @TableName
    and    CONSTRAINT_TYPE = 'PRIMARY KEY'
    and    c.TABLE_NAME = pk.TABLE_NAME
    and    c.CONSTRAINT_NAME = pk.CONSTRAINT_NAME&amp;lt;/pre&amp;gt;</Body><CommentEnabled>True</CommentEnabled><ViewCount>0</ViewCount><ReleaseDate>11/6/2009 7:37:55 AM</ReleaseDate><TotalComment>0</TotalComment><IsMedia>False</IsMedia><IsPicture>False</IsPicture><IsVote>True</IsVote><ArticlePassword /><PostVisible>0</PostVisible><ArticlePath>/2009/11/6/Lay-Primary-key-trong-table---SQL-Server-250</ArticlePath><Approved>True</Approved><ImagePath /><CategoryId>35</CategoryId><ArrayCatID>35|25</ArrayCatID></Article></Articles>